package cn.edu.sjtu.se.dslab.component.aadl;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import cn.edu.sjtu.se.dslab.auth.User;

/**
 * 数据库中的aadl-->更改说明
 * @author sunke
 *
 */

@Entity
@Table(name = "aadl_loger")
public class AADLLoger implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = -3704528052062684561L;
	
	private long id;
	
	private String  logInfo;
	
	private User operator;
	
	private Date time;
	
	private AADLModel model;
	
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}
	
	@Lob
	@Column(name = "log_info", columnDefinition = "TEXT", nullable = true)
	public String getLogInfo() {
		return logInfo;
	}

	public void setLogInfo(String logInfo) {
		this.logInfo = logInfo;
	}
	@ManyToOne(cascade = { CascadeType.REFRESH})
	@JoinColumn(name = "operator")
	public User getOperator() {
		return operator;
	}

	public void setOperator(User operator) {
		this.operator = operator;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column(nullable = false, insertable = true, name = "operate_time")
	public Date getTime() {
		return time;
	}

	public void setTime(Date time) {
		this.time = time;
	}
	
	@ManyToOne(cascade = { CascadeType.REFRESH})
	@JoinColumn(name = "model_id")
	public AADLModel getModel() {
		return model;
	}

	public void setModel(AADLModel model) {
		this.model = model;
	}
	
}
